/**
* @file drv_qspi.h
* @brief  qspi驱动
* @details 
* @author huangbin
* @version V1.0.0
* @date 2025-07-13
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/
#ifndef __DRV_QSPI_H__
#define	__DRV_QSPI_H__
#include "inc.h"

#ifdef __cplusplus
 extern "C" {
#endif /* __cplusplus */
////////////////////////////////////////////////////////////////////////////////////
#define QSPIx_CLK_PIN						GPIO_Pin_2
#define QSPIx_CLK_GPIO_PORT					GPIOB
#define QSPIx_CLK_GPIO_CLK					RCC_APB2Periph_GPIOB

#define QSPIx_BANK1_CS_PIN					GPIO_Pin_10
#define QSPIx_BANK1_CS_GPIO_PORT			GPIOB
#define QSPIx_BANK1_CS_GPIO_CLK				RCC_APB2Periph_GPIOB

#define QSPIx_BANK1_D0_PIN					GPIO_Pin_6
#define QSPIx_BANK1_D0_GPIO_PORT			GPIOB
#define QSPIx_BANK1_D0_GPIO_CLK				RCC_APB2Periph_GPIOB

#define QSPIx_BANK1_D1_PIN					GPIO_Pin_5
#define QSPIx_BANK1_D1_GPIO_PORT			GPIOB
#define QSPIx_BANK1_D1_GPIO_CLK				RCC_APB2Periph_GPIOB

#define QSPIx_BANK1_D2_PIN					GPIO_Pin_4
#define QSPIx_BANK1_D2_GPIO_PORT			GPIOB
#define QSPIx_BANK1_D2_GPIO_CLK				RCC_APB2Periph_GPIOB

#define QSPIx_BANK1_D3_PIN					GPIO_Pin_3
#define QSPIx_BANK1_D3_GPIO_PORT			GPIOB
#define QSPIx_BANK1_D3_GPIO_CLK				RCC_APB2Periph_GPIOB

#define QSPI_XIP_ADDR						0xB1000000

#define QSPI_DMA_CHANNEL					DMA1_Channel1
#define QSPI_DMA_FLAG_TC					DMA1_FLAG_TC1


#define QSPI_M2M_DMA_CHANNEL				DMA1_Channel2
#define QSPI_M2M_DMA_FLAG_TC				DMA1_FLAG_TC2


extern void QSPI_DMA_Send(uint8_t *buf,uint16_t len);
extern void QSPI_DMA_Recv(uint8_t *buf,uint16_t len);
extern void QSPI_Configuration(void);
extern void QSPI_GPIO_Config(void);
//DMA config: qspi to memory
extern void QSPI_DMA_Config(void);
//DMA config:  memory to memory
extern void QSPI_M2M_DMA_Config(void);
///////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
/************************END OF FILE*********************************************/

